home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Sample Code / Newton Sample Code 1.1 / Communications / ADSP sample-1 / ADSPSample.text < prev    next >
Encoding:
Text File  |  1993-12-22  |  22.3 KB  |  857 lines  |  [TEXT/MPS ]

  1. // Constants good to have.
  2. constant kAppSymbol := '|ADSP:PIEDTS|;
  3. constant kAppName := "ADSP";
  4.  
  5. // We don't use any install or remove scripts here
  6.  
  7. // ---- End Project Data ----
  8.  
  9. // ---- Beginning of Print templates ----
  10.  
  11. // ---- End of Print templates ----
  12.  
  13. ADSPSample :=
  14.    {title: "ADSP Sample",
  15.     viewBounds: {top: 0, left: 0, right: 240, bottom: 336},
  16.     InitConnection:
  17.       func()
  18.       begin
  19.          SetValue(StatusArea,'text, "Connecting...\n");
  20.          RefreshViews();
  21.       
  22.          ep := {_proto: baseEndpoint, _parent: self};    // make a RAM copy so we can modify it
  23.       
  24.          local err := ep:Instantiate(ep, nil);
  25.       
  26.          if err then
  27.             begin
  28.                EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "Sorry, can't open AppleTalk!"));
  29.                SetValue(StatusArea, 'text, "Unable to initialize...");
  30.                return;
  31.             end;
  32.       
  33.          err := ep:Connect(LiveremoteAddress, nil);         // always check for results from Connect
  34.       
  35.          if err then
  36.             begin
  37.                EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "Couldn't connect..." & NumberStr(err)));
  38.                SetValue(StatusArea, 'text, "Unable to connect...");
  39.                return;
  40.             end;
  41.       
  42.          ep.myBase := _parent;
  43.          ep:SetInputSpec(ep.doInput);        // set up first inputSpec
  44.          SetValue(StatusArea,'text, "Connected, Waiting for Disconnect...");
  45.          connected := true;
  46.       end,
  47.     ReleaseConnection:
  48.       func()
  49.       begin
  50.           if (connected) then
  51.               begin
  52.               ep.nextInputSpec := nil;             // no more input
  53.               ep:SetInputSpec(nil);                // kill the current inputSpec
  54.               ep:Abort();                          // asynchronously abort any pending I/O
  55.       
  56.               // must use a delayed action to dispose
  57.               AddDelayedAction(DisposeConnection, [], 100);
  58.               end;
  59.       end,
  60.     PutDataInStatusArea:
  61.       func(s)
  62.       begin
  63.          SetValue(StatusArea, 'text, s);
  64.       end,
  65.     PutDataInReceivedArea:
  66.       func(s)
  67.       begin
  68.          SetValue(ReceivedArea, 'text, s);
  69.       end,
  70.     viewSetupDoneScript:
  71.       func()
  72.       begin
  73.          ActiveConnection := 0;
  74.          ActiveListenConnection := 0;
  75.       
  76.          LiveRemoteAddress := DeepClone(remoteAddress);      // clone so we could modify this one
  77.       end,
  78.     SendDataInSendField:
  79.       func()
  80.       begin
  81.          ep:Output(SendDataField.entryLine.text, kMore);
  82.          ep:Output([unicodeCR,unicodeLF], kMore);   
  83.          ep:FlushOutput();
  84.       end,
  85.     connected: nil,
  86.     remoteAddress:
  87.       {
  88.               type: 'address,
  89.               label: kCMARouteLabel,
  90.               opCode: opSetRequired,
  91.               data : {
  92.                   addressType: kNamedAppleTalkAddress,
  93.                   addressData: "Sandvik:ADSP@RD5/2"         // hard coded value, change if needed
  94.                  }
  95.       },
  96.     baseEndpoint:
  97.       {
  98.            //_proto: @174,            // ROM protoEndpoint
  99.            _proto: protoEndpoint,     // NTK protoEndpoint
  100.       
  101.               configOptions:
  102.         [
  103.           // adsp tool
  104.                    { label:     "atlk", type: 'service, opCode: opSetRequired },
  105.       
  106.                    { label: "atlk", type: 'option, opCode: opSetRequired,
  107.                         data: [97, 100, 115, 112] },        // 'adsp' (can't use "adsp" because it includes a null terminator)
  108.       
  109.           { label: "endp", type: 'option, opCode: opSetRequired,
  110.             data: "TADSPEndpoint" },
  111.               ],
  112.       
  113.          myBase: nil,
  114.       
  115.          // All endpoint related exceptions end up here, catch them.
  116.          exceptionHandler: func(exception)
  117.             begin
  118.                EnsureInternal(GetRoot():Notify(kNotifyAlert, "ADSP Sample", "Exception: " & exception.data));
  119.                return true;
  120.             end,
  121.       
  122.          doInput:
  123.             {
  124.             InputForm: 'string,
  125.             endCharacter: unicodeCR,
  126.        
  127.             InputScript: func(endpoint, s)
  128.                begin
  129.                   Perform(endpoint.myBase, 'PutDataInStatusArea, [Clone("Data Received...")]);
  130.       
  131.                   Perform(endpoint.myBase, 'PutDataInReceivedArea, [Clone(s)]);
  132.                   
  133.                end,
  134.       
  135.             discardAfter: 200,
  136.             },
  137.       },
  138.     ep: nil,
  139.     DisposeConnection:
  140.       func()
  141.       begin
  142.           ep:Disconnect();
  143.           ep:Dispose();
  144.           connected := nil;
  145.           :PutDataInStatusArea("Ready to connect...");
  146.       end,
  147.     LiveRemoteAddress:
  148.       // the ADSP address frame, in memory, so we could modify this one
  149.       nil,
  150.     _proto: protoApp,
  151.     debug: "ADSPSample"
  152.    };
  153.  
  154. _view000 := /* child of ADSPSample */
  155.    {viewFlags: 1,
  156.     viewFormat: 304,
  157.     viewBounds: {left: 11, top: 219, right: 233, bottom: 297},
  158.     viewclass: 74
  159.    };
  160.  
  161.  
  162.  
  163. StatusArea := /* child of ADSPSample */
  164.    {text: "",
  165.     viewBounds: {left: 10, top: 26, right: 232, bottom: 64},
  166.     viewJustify: 0,
  167.     viewFormat: 67436880,
  168.     _proto: protoStaticText,
  169.     debug: "StatusArea"
  170.    };
  171. // View StatusArea is declared to ADSPSample
  172.  
  173.  
  174.  
  175. ReceivedArea := /* child of ADSPSample */
  176.    {text: "",
  177.     viewBounds: {left: 10, top: 82, right: 232, bottom: 176},
  178.     viewJustify: 0,
  179.     viewFormat: 67436880,
  180.     _proto: protoStaticText,
  181.     debug: "ReceivedArea"
  182.    };
  183. // View ReceivedArea is declared to ADSPSample
  184.  
  185.  
  186.  
  187. Status := /* child of ADSPSample */
  188.    {text: "Status",
  189.     viewBounds: {left: 18, top: 18, right: 114, bottom: 34},
  190.     viewTransferMode: 0
  191.     ,
  192.     _proto: protoStaticText,
  193.     debug: "Status"
  194.    };
  195.  
  196.  
  197.  
  198. Received := /* child of ADSPSample */
  199.    {text: "Received Data",
  200.     viewBounds: {left: 18, top: 74, right: 114, bottom: 90},
  201.     viewTransferMode: 0
  202.     ,
  203.     _proto: protoStaticText,
  204.     debug: "Received"
  205.    };
  206.  
  207.  
  208.  
  209. Connect := /* child of ADSPSample */
  210.    {text: "Connect",
  211.     buttonClickScript:
  212.       func()
  213.       begin
  214.           if not connected then
  215.               :InitConnection();
  216.           else
  217.               EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "already connected!"));
  218.       end,
  219.     viewBounds: {left: 12, top: 188, right: 120, bottom: 208},
  220.     viewSetupDoneScript:
  221.       func()
  222.       begin
  223.          :PutDataInStatusArea("Ready to Connect...");
  224.       end,
  225.     _proto: protoTextButton,
  226.     debug: "Connect"
  227.    };
  228. // View Connect is declared to ADSPSample
  229.  
  230.  
  231.  
  232. Disconnect := /* child of ADSPSample */
  233.    {text: "Disconnect",
  234.     buttonClickScript:
  235.       func()
  236.       begin
  237.           if connected then
  238.               begin
  239.               :ReleaseConnection();
  240.               :PutDataInStatusArea("Disconnecting...");
  241.               end;
  242.           else
  243.               EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "not connected!"));
  244.       end,
  245.     viewBounds: {left: 132, top: 188, right: 232, bottom: 208},
  246.     viewQuitScript:
  247.       func()
  248.       begin
  249.          :ReleaseConnection();
  250.       end,
  251.     _proto: protoTextButton,
  252.     debug: "Disconnect"
  253.    };
  254. // View Disconnect is declared to ADSPSample
  255.  
  256.  
  257.  
  258. SendDataField := /* child of ADSPSample */
  259.    {viewBounds: {top: 226, left: 18, right: 226, bottom: 290},
  260.     viewFormat: 256,
  261.     viewlinespacing: 16,
  262.     label: "Data:",
  263.     textSetup:
  264.       func()
  265.       begin
  266.          return "this is a test";
  267.       end,
  268.     indent: 80,
  269.     _proto: protoLabelInputLine,
  270.     debug: "SendDataField"
  271.    };
  272. // View SendDataField is declared to ADSPSample
  273.  
  274.  
  275.  
  276. SendButton := /* child of ADSPSample */
  277.    {text: "Send",
  278.     buttonClickScript:
  279.       func()
  280.       begin
  281.           if connected then
  282.               :SendDataInSendField();
  283.           else
  284.               EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "not connected!"));
  285.       end,
  286.     viewBounds: {left: 36, top: 308, right: 104, bottom: 328},
  287.     _proto: protoTextButton,
  288.     debug: "SendButton"
  289.    };
  290. // View SendButton is declared to ADSPSample
  291.  
  292.  
  293.  
  294. configureButton := /* child of ADSPSample */
  295.    {text: "Configure",
  296.     buttonClickScript:
  297.       func()
  298.       begin
  299.       // Open a view that will ask for the type and name info, and the zone info as well.
  300.          ConfigureView:Open();
  301.       end,
  302.     viewBounds: {left: 128, top: 308, right: 196, bottom: 328},
  303.     _proto: protoTextButton,
  304.     debug: "configureButton"
  305.    };
  306.  
  307.  
  308.  
  309. ConfigureView := /* child of ADSPSample */
  310.    {viewBounds: {left: 0, top: 46, right: 228, bottom: 194},
  311.     viewSetupFormScript:
  312.       func()
  313.       begin
  314.          addressData := GetRoot().|ADSP:PIEDTS|.LiveRemoteAddress.data.addressData;   
  315.       
  316.          // Start munging so the stuff looks real
  317.          // First the zone.
  318.          local pos := StrPos(addressData, "@", 0);
  319.          ADSPZone := SubStr(addressData, pos+1, 32);
  320.       
  321.          // Then the name.
  322.          local pos2 := StrPos(addressData, ":", 0);
  323.         ADSPName := SubStr(addressData, 0, pos2);
  324.       
  325.          // Finally the type
  326.          ADSPType := SubStr(addressData, pos2 + 1, pos - pos2 - 1);
  327.       
  328.       end,
  329.     ADSPName: nil,
  330.     ADSPType: nil,
  331.     ADSPZone: nil,
  332.     adressData: nil,
  333.     viewQuitScript:
  334.       func()
  335.       begin
  336.       // The Deeds are done, update the address info in the app base view.
  337.          GetRoot().|ADSP:PIEDTS|.LiveRemoteAddress.data.addressData := 
  338.             Stringer([ADSPName, ":", ADSPType, "@", ADSPZone]);
  339.       end,
  340.     _proto: protoFloatNGo,
  341.     debug: "ConfigureView"
  342.    };
  343. // View ConfigureView is declared to ADSPSample
  344.  
  345. mainLabel := /* child of ConfigureView */
  346.    {text: "Specify ADSP Server info:",
  347.     viewBounds: {left: 32, top: 8, right: 216, bottom: 32},
  348.     _proto: protoStaticText,
  349.     debug: "mainLabel"
  350.    };
  351.  
  352.  
  353.  
  354. NameInput := /* child of ConfigureView */
  355.    {viewBounds: {left: 0, top: 40, right: 224, bottom: 64},
  356.     label: "Server Name:",
  357.     viewSetupFormScript:
  358.       func()
  359.       begin
  360.          // get the address data string
  361.          local x := GetRoot().kAppSymbol.liveRemoteAddress.data.addressData;
  362.       
  363.          //SetValue(entry, 'text, GetRoot()kAppSymbol.LiveRemoteAddress
  364.       end,
  365.     textSetup:
  366.       func()
  367.       begin
  368.       // Return the ADSP name stored in the parent view for default setup.
  369.           return ADSPName;
  370.       end,
  371.     textChanged:
  372.       func()
  373.       begin
  374.       // We did something with the values, update parent.
  375.          ADSPName := entryline.text;
  376.       end,
  377.     _proto: protoLabelInputLine,
  378.     debug: "NameInput"
  379.    };
  380. // View NameInput is declared to ConfigureView
  381.  
  382.  
  383.  
  384. TypeInput := /* child of ConfigureView */
  385.    {viewBounds: {left: 0, top: 72, right: 224, bottom: 96},
  386.     label: "Server Type:",
  387.     textSetup:
  388.       func()
  389.       begin
  390.       // Return the ADSP Type in the parent view as the default value.
  391.          return ADSPType;
  392.       end,
  393.     textChanged:
  394.       func()
  395.       begin
  396.       // We did something with the values, update parent.
  397.          ADSPType := entryline.text;
  398.       end,
  399.     _proto: protoLabelInputLine,
  400.     debug: "TypeInput"
  401.    };
  402. // View TypeInput is declared to ConfigureView
  403.  
  404.  
  405.  
  406. ZoneInput := /* child of ConfigureView */
  407.    {viewBounds: {left: 0, top: 104, right: 224, bottom: 128},
  408.     label: "Server Zone:",
  409.     textSetup:
  410.       func()
  411.       begin
  412.       // Return the ADSP Zone string stored in the parent view as the default value.
  413.          return ADSPZone;
  414.       end,
  415.     textChanged:
  416.       func()
  417.       begin
  418.       // We did something with the values, update parent.
  419.          ADSPZone := entryline.text;
  420.       end,
  421.     _proto: protoLabelInputLine,
  422.     debug: "ZoneInput"
  423.    };
  424. // View ZoneInput is declared to ConfigureView
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431. // ---- Beginning of non-used User Protos ----
  432.  
  433. // ---- End of non-used User Protos ----
  434.  
  435.  
  436.  
  437. // ---- Beginning of section for non used Layout files ----
  438.  
  439. ADSPSample :=
  440.    {title: "ADSP Sample",
  441.     viewBounds: {top: 0, left: 0, right: 240, bottom: 336},
  442.     InitConnection:
  443.       func()
  444.       begin
  445.          SetValue(StatusArea,'text, "Connecting...\n");
  446.          RefreshViews();
  447.       
  448.          ep := {_proto: baseEndpoint, _parent: self};    // make a RAM copy so we can modify it
  449.       
  450.          local err := ep:Instantiate(ep, nil);
  451.       
  452.          if err then
  453.             begin
  454.                EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "Sorry, can't open AppleTalk!"));
  455.                SetValue(StatusArea, 'text, "Unable to initialize...");
  456.                return;
  457.             end;
  458.       
  459.          err := ep:Connect(LiveremoteAddress, nil);         // always check for results from Connect
  460.       
  461.          if err then
  462.             begin
  463.                EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "Couldn't connect..." & NumberStr(err)));
  464.                SetValue(StatusArea, 'text, "Unable to connect...");
  465.                return;
  466.             end;
  467.       
  468.          ep.myBase := _parent;
  469.          ep:SetInputSpec(ep.doInput);        // set up first inputSpec
  470.          SetValue(StatusArea,'text, "Connected, Waiting for Disconnect...");
  471.          connected := true;
  472.       end,
  473.     ReleaseConnection:
  474.       func()
  475.       begin
  476.           if (connected) then
  477.               begin
  478.               ep.nextInputSpec := nil;             // no more input
  479.               ep:SetInputSpec(nil);                // kill the current inputSpec
  480.               ep:Abort();                          // asynchronously abort any pending I/O
  481.       
  482.               // must use a delayed action to dispose
  483.               AddDelayedAction(DisposeConnection, [], 100);
  484.               end;
  485.       end,
  486.     PutDataInStatusArea:
  487.       func(s)
  488.       begin
  489.          SetValue(StatusArea, 'text, s);
  490.       end,
  491.     PutDataInReceivedArea:
  492.       func(s)
  493.       begin
  494.          SetValue(ReceivedArea, 'text, s);
  495.       end,
  496.     viewSetupDoneScript:
  497.       func()
  498.       begin
  499.          ActiveConnection := 0;
  500.          ActiveListenConnection := 0;
  501.       
  502.          LiveRemoteAddress := DeepClone(remoteAddress);      // clone so we could modify this one
  503.       end,
  504.     SendDataInSendField:
  505.       func()
  506.       begin
  507.          ep:Output(SendDataField.entryLine.text, kMore);
  508.          ep:Output([unicodeCR,unicodeLF], kMore);   
  509.          ep:FlushOutput();
  510.       end,
  511.     connected: nil,
  512.     remoteAddress:
  513.       {
  514.               type: 'address,
  515.               label: kCMARouteLabel,
  516.               opCode: opSetRequired,
  517.               data : {
  518.                   addressType: kNamedAppleTalkAddress,
  519.                   addressData: "Sandvik:ADSP@RD5/2"         // hard coded value, change if needed
  520.                  }
  521.       },
  522.     baseEndpoint:
  523.       {
  524.            //_proto: @174,            // ROM protoEndpoint
  525.            _proto: protoEndpoint,     // NTK protoEndpoint
  526.       
  527.               configOptions:
  528.         [
  529.           // adsp tool
  530.                    { label:     "atlk", type: 'service, opCode: opSetRequired },
  531.       
  532.                    { label: "atlk", type: 'option, opCode: opSetRequired,
  533.                         data: [97, 100, 115, 112] },        // 'adsp' (can't use "adsp" because it includes a null terminator)
  534.       
  535.           { label: "endp", type: 'option, opCode: opSetRequired,
  536.             data: "TADSPEndpoint" },
  537.               ],
  538.       
  539.          myBase: nil,
  540.       
  541.          // All endpoint related exceptions end up here, catch them.
  542.          exceptionHandler: func(exception)
  543.             begin
  544.                EnsureInternal(GetRoot():Notify(kNotifyAlert, "ADSP Sample", "Exception: " & exception.data));
  545.                return true;
  546.             end,
  547.       
  548.          doInput:
  549.             {
  550.             InputForm: 'string,
  551.             endCharacter: unicodeCR,
  552.        
  553.             InputScript: func(endpoint, s)
  554.                begin
  555.                   Perform(endpoint.myBase, 'PutDataInStatusArea, [Clone("Data Received...")]);
  556.       
  557.                   Perform(endpoint.myBase, 'PutDataInReceivedArea, [Clone(s)]);
  558.                   
  559.                end,
  560.       
  561.             discardAfter: 200,
  562.             },
  563.       },
  564.     ep: nil,
  565.     DisposeConnection:
  566.       func()
  567.       begin
  568.           ep:Disconnect();
  569.           ep:Dispose();
  570.           connected := nil;
  571.           :PutDataInStatusArea("Ready to connect...");
  572.       end,
  573.     LiveRemoteAddress:
  574.       // the ADSP address frame, in memory, so we could modify this one
  575.       nil,
  576.     _proto: protoApp,
  577.     debug: "ADSPSample"
  578.    };
  579.  
  580. _view001 := /* child of ADSPSample */
  581.    {viewFlags: 1,
  582.     viewFormat: 304,
  583.     viewBounds: {left: 11, top: 219, right: 233, bottom: 297},
  584.     viewclass: 74
  585.    };
  586.  
  587.  
  588.  
  589. StatusArea := /* child of ADSPSample */
  590.    {text: "",
  591.     viewBounds: {left: 10, top: 26, right: 232, bottom: 64},
  592.     viewJustify: 0,
  593.     viewFormat: 67436880,
  594.     _proto: protoStaticText,
  595.     debug: "StatusArea"
  596.    };
  597. // View StatusArea is declared to ADSPSample
  598.  
  599.  
  600.  
  601. ReceivedArea := /* child of ADSPSample */
  602.    {text: "",
  603.     viewBounds: {left: 10, top: 82, right: 232, bottom: 176},
  604.     viewJustify: 0,
  605.     viewFormat: 67436880,
  606.     _proto: protoStaticText,
  607.     debug: "ReceivedArea"
  608.    };
  609. // View ReceivedArea is declared to ADSPSample
  610.  
  611.  
  612.  
  613. Status := /* child of ADSPSample */
  614.    {text: "Status",
  615.     viewBounds: {left: 18, top: 18, right: 114, bottom: 34},
  616.     viewTransferMode: 0
  617.     ,
  618.     _proto: protoStaticText,
  619.     debug: "Status"
  620.    };
  621.  
  622.  
  623.  
  624. Received := /* child of ADSPSample */
  625.    {text: "Received Data",
  626.     viewBounds: {left: 18, top: 74, right: 114, bottom: 90},
  627.     viewTransferMode: 0
  628.     ,
  629.     _proto: protoStaticText,
  630.     debug: "Received"
  631.    };
  632.  
  633.  
  634.  
  635. Connect := /* child of ADSPSample */
  636.    {text: "Connect",
  637.     buttonClickScript:
  638.       func()
  639.       begin
  640.           if not connected then
  641.               :InitConnection();
  642.           else
  643.               EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "already connected!"));
  644.       end,
  645.     viewBounds: {left: 12, top: 188, right: 120, bottom: 208},
  646.     viewSetupDoneScript:
  647.       func()
  648.       begin
  649.          :PutDataInStatusArea("Ready to Connect...");
  650.       end,
  651.     _proto: protoTextButton,
  652.     debug: "Connect"
  653.    };
  654. // View Connect is declared to ADSPSample
  655.  
  656.  
  657.  
  658. Disconnect := /* child of ADSPSample */
  659.    {text: "Disconnect",
  660.     buttonClickScript:
  661.       func()
  662.       begin
  663.           if connected then
  664.               begin
  665.               :ReleaseConnection();
  666.               :PutDataInStatusArea("Disconnecting...");
  667.               end;
  668.           else
  669.               EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "not connected!"));
  670.       end,
  671.     viewBounds: {left: 132, top: 188, right: 232, bottom: 208},
  672.     viewQuitScript:
  673.       func()
  674.       begin
  675.          :ReleaseConnection();
  676.       end,
  677.     _proto: protoTextButton,
  678.     debug: "Disconnect"
  679.    };
  680. // View Disconnect is declared to ADSPSample
  681.  
  682.  
  683.  
  684. SendDataField := /* child of ADSPSample */
  685.    {viewBounds: {top: 226, left: 18, right: 226, bottom: 290},
  686.     viewFormat: 256,
  687.     viewlinespacing: 16,
  688.     label: "Data:",
  689.     textSetup:
  690.       func()
  691.       begin
  692.          return "this is a test";
  693.       end,
  694.     indent: 80,
  695.     _proto: protoLabelInputLine,
  696.     debug: "SendDataField"
  697.    };
  698. // View SendDataField is declared to ADSPSample
  699.  
  700.  
  701.  
  702. SendButton := /* child of ADSPSample */
  703.    {text: "Send",
  704.     buttonClickScript:
  705.       func()
  706.       begin
  707.           if connected then
  708.               :SendDataInSendField();
  709.           else
  710.               EnsureInternal(:Notify(kNotifyAlert, "ADSP Sample", "not connected!"));
  711.       end,
  712.     viewBounds: {left: 36, top: 308, right: 104, bottom: 328},
  713.     _proto: protoTextButton,
  714.     debug: "SendButton"
  715.    };
  716. // View SendButton is declared to ADSPSample
  717.  
  718.  
  719.  
  720. configureButton := /* child of ADSPSample */
  721.    {text: "Configure",
  722.     buttonClickScript:
  723.       func()
  724.       begin
  725.       // Open a view that will ask for the type and name info, and the zone info as well.
  726.          ConfigureView:Open();
  727.       end,
  728.     viewBounds: {left: 128, top: 308, right: 196, bottom: 328},
  729.     _proto: protoTextButton,
  730.     debug: "configureButton"
  731.    };
  732.  
  733.  
  734.  
  735. ConfigureView := /* child of ADSPSample */
  736.    {viewBounds: {left: 0, top: 46, right: 228, bottom: 194},
  737.     viewSetupFormScript:
  738.       func()
  739.       begin
  740.          addressData := GetRoot().|ADSP:PIEDTS|.LiveRemoteAddress.data.addressData;   
  741.       
  742.          // Start munging so the stuff looks real
  743.          // First the zone.
  744.          local pos := StrPos(addressData, "@", 0);
  745.          ADSPZone := SubStr(addressData, pos+1, 32);
  746.       
  747.          // Then the name.
  748.          local pos2 := StrPos(addressData, ":", 0);
  749.         ADSPName := SubStr(addressData, 0, pos2);
  750.       
  751.          // Finally the type
  752.          ADSPType := SubStr(addressData, pos2 + 1, pos - pos2 - 1);
  753.       
  754.       end,
  755.     ADSPName: nil,
  756.     ADSPType: nil,
  757.     ADSPZone: nil,
  758.     adressData: nil,
  759.     viewQuitScript:
  760.       func()
  761.       begin
  762.       // The Deeds are done, update the address info in the app base view.
  763.          GetRoot().|ADSP:PIEDTS|.LiveRemoteAddress.data.addressData := 
  764.             Stringer([ADSPName, ":", ADSPType, "@", ADSPZone]);
  765.       end,
  766.     _proto: protoFloatNGo,
  767.     debug: "ConfigureView"
  768.    };
  769. // View ConfigureView is declared to ADSPSample
  770.  
  771. mainLabel := /* child of ConfigureView */
  772.    {text: "Specify ADSP Server info:",
  773.     viewBounds: {left: 32, top: 8, right: 216, bottom: 32},
  774.     _proto: protoStaticText,
  775.     debug: "mainLabel"
  776.    };
  777.  
  778.  
  779.  
  780. NameInput := /* child of ConfigureView */
  781.    {viewBounds: {left: 0, top: 40, right: 224, bottom: 64},
  782.     label: "Server Name:",
  783.     viewSetupFormScript:
  784.       func()
  785.       begin
  786.          // get the address data string
  787.          local x := GetRoot().kAppSymbol.liveRemoteAddress.data.addressData;
  788.       
  789.          //SetValue(entry, 'text, GetRoot()kAppSymbol.LiveRemoteAddress
  790.       end,
  791.     textSetup:
  792.       func()
  793.       begin
  794.       // Return the ADSP name stored in the parent view for default setup.
  795.           return ADSPName;
  796.       end,
  797.     textChanged:
  798.       func()
  799.       begin
  800.       // We did something with the values, update parent.
  801.          ADSPName := entryline.text;
  802.       end,
  803.     _proto: protoLabelInputLine,
  804.     debug: "NameInput"
  805.    };
  806. // View NameInput is declared to ConfigureView
  807.  
  808.  
  809.  
  810. TypeInput := /* child of ConfigureView */
  811.    {viewBounds: {left: 0, top: 72, right: 224, bottom: 96},
  812.     label: "Server Type:",
  813.     textSetup:
  814.       func()
  815.       begin
  816.       // Return the ADSP Type in the parent view as the default value.
  817.          return ADSPType;
  818.       end,
  819.     textChanged:
  820.       func()
  821.       begin
  822.       // We did something with the values, update parent.
  823.          ADSPType := entryline.text;
  824.       end,
  825.     _proto: protoLabelInputLine,
  826.     debug: "TypeInput"
  827.    };
  828. // View TypeInput is declared to ConfigureView
  829.  
  830.  
  831.  
  832. ZoneInput := /* child of ConfigureView */
  833.    {viewBounds: {left: 0, top: 104, right: 224, bottom: 128},
  834.     label: "Server Zone:",
  835.     textSetup:
  836.       func()
  837.       begin
  838.       // Return the ADSP Zone string stored in the parent view as the default value.
  839.          return ADSPZone;
  840.       end,
  841.     textChanged:
  842.       func()
  843.       begin
  844.       // We did something with the values, update parent.
  845.          ADSPZone := entryline.text;
  846.       end,
  847.     _proto: protoLabelInputLine,
  848.     debug: "ZoneInput"
  849.    };
  850. // View ZoneInput is declared to ConfigureView
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857. // End of output